<template>
  
  <div>
     <el-upload
        v-model:file-list="fileList"
        ref="upload"
        class="avatar-uploader"
        action="/api/goodinfo/images"  
         multiple
        :show-file-list="true"
        :on-success="getres"
        :before-upload="bfimgup"
        :data="{goodname,price,count}"
        :auto-upload="false"
     >
     <el-button>上传图片</el-button>
     </el-upload> 
     <el-button type="success" @click="submitUpload">
         确定
    </el-button>
     </div>  
</template>

<script>
import { ElMessage, ElMessageBox } from 'element-plus'
const open = () => {
  
}


  export default {
    data(){
      return{
        fileList:[],
        
       imgurl:"",
       goodname:"",
       price:"",
       count:""
       

      }
     console.log(this.fileList);
    },
    
    methods:{
      submitUpload(){
        this.$refs.upload.submit();
      },
      open(){
        ElMessageBox.prompt('请输入信息',  {
        confirmButtonText: '确定',
        cancelButtonText: '关闭',
    
  })
    
    

      },
      //定义图片上传的函数
      getres(res){
       
      },
      //定义图片上传前的函数 并返回值false
      bfimgup (file){
        console.log(file)
        // this.goodname ="商品名称";
        // this.price ="50";
        // this.count ="99"
     
      }
    }
  }
</script>

<style lang="scss" scoped>

</style>